#include<iostream>
#include<cstdio>
using namespace std;
struct dataa{
	long long a;
	int inde;
	bool xx;
}b[8050];
long long n;
long long q;
long long x,y,z;
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d",&n);
	scanf("%d",&q);
	for(long long i=1;i<=n;i++){
		scanf("%d",&(b[i].a));
		b[i].inde=i;
		b[i].xx=false;
	}
	for(long long ii=1;ii<=q;ii++){
		scanf("%d",&x);
		scanf("%d",&y);
		if(x==1){
			scanf("%d",&z);
			b[y].a=z;
			continue;
		}
		if(x==2){
			b[y].xx=true;
			for (int i=n;i>0;i--){
				for (int j=1;j<i;j++)
					if(b[j+1].a<b[j].a){
						swap(b[j+1],b[j]);
					}
				if(b[i].xx){
					cout<<i<<endl;
					b[i].xx=false;
					break;
				}
			}
			for (int i=n;i>0;i--){
				for (int j=1;j<i;j++)
					if(b[j+1].inde<b[j].inde){
						swap(b[j+1],b[j]);
					}
			}
			
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
